package com.luo.ai.assistant.etl;

import org.springframework.ai.document.Document;
import org.springframework.ai.document.DocumentWriter;
import org.springframework.ai.document.MetadataMode;
import org.springframework.ai.vectorstore.VectorStore;

import java.util.List;

/**
 * 文档写入
 *
 * @author luohq
 * @date 2025-01-02 9:38
 */
public interface MyDocumentWriter extends DocumentWriter {

    /**
     * Write to file.
     *
     * @param documents the documents
     * @param filePath the file path
     * @see org.springframework.ai.writer.FileDocumentWriter
     */
    void writeToFile(List<Document> documents, String filePath);

    /**
     * Write to file.
     *
     * @param documents the documents
     * @param filePath The name of the file to write the documents to.
     * @param withDocumentMarkers Whether to include document markers in the output.
     * @param metadataMode Document content formatter mode. Specifies what document content to be written to the file.
     * @param append if {@code true}, then data will be written to the end of the file
     * @see org.springframework.ai.writer.FileDocumentWriter
     */
    void writeToFile(List<Document> documents, String filePath,
                     boolean withDocumentMarkers, MetadataMode metadataMode, boolean append);


    /**
     * Write to vector store.
     *
     * @param documents the documents
     * @see VectorStore
     * @see org.springframework.ai.vectorstore.SimpleVectorStore
     * @link <a href="https://docs.spring.io/spring-ai/reference/api/vectordbs.html">https://docs.spring.io/spring-ai/reference/api/vectordbs.html</a>
     */
    void writeToVectorStore(List<Document> documents);

    /**
     * Write to vector store.
     *
     * @param documents the documents
     * @param vectorStore the vector store
     * @see VectorStore
     * @see org.springframework.ai.vectorstore.SimpleVectorStore
     * @link <a href="https://docs.spring.io/spring-ai/reference/api/vectordbs.html">https://docs.spring.io/spring-ai/reference/api/vectordbs.html</a>
     */
    @Deprecated
    void writeToVectorStore(List<Document> documents, VectorStore vectorStore);

}
